<{include file="../templates/front/header.html"}>
<script type="text/javascript" src="../js/jquery.js">
</script>
<script type="text/javascript" src="../templates/front/js/region.js">
</script>

<script type="text/javascript">
function getxhr(){
	var xhr = false;
	if(window . XMLHttpRequest){
		xhr = new XMLHttpRequest();
	}else{
		xhr = window . ActiveXObject('Microsoft . XMLHttp');
	}
	return xhr;
}

function goods_del(obj, goods_id){

	var xhr = getxhr();
	var url = 'flow.php?act=goods_del&goods_id=' + goods_id;

	xhr.open('GET', url, false);
	xhr.onreadystatechange=function (){
		
		if(xhr.readyState==4){
			var tr = obj.parentNode.parentNode;
			tr.parentNode.removeChild(tr);
			
			var price_obj = document.getElementById('price');
			var price = xhr.responseText;
			
			if(price == 0){
				price_obj . innerHTML = '<td>￥&nbsp;0.00元</td>';
			}else{
				price_obj . innerHTML = '<td>￥&nbsp;' + price + '元</td>';
			}
		}
	}
	
	xhr.send(null);
	
}
</script>

<body>

<!-- 购物车列表start -->
<{if $action eq 'cart'}>
<div class="block">
	<div class="blank"></div>
	<!-- 购物车内容 -->
	<div class="goodsTitle" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">商品列表</div>
	<form id="formCart" name="formCart" method="post" action="flow.php">
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3">
			<{if $goods neq ''}>
			<tr>
				<th bgcolor="#ffffff">商品名称</th>
				<th bgcolor="#ffffff">市场价</th>
				<th bgcolor="#ffffff">本店价</th>
				<th bgcolor="#ffffff">购买数量</th>
				<th bgcolor="#ffffff">小计</th>
				<th bgcolor="#ffffff">操作</th>
			</tr>
			<{foreach from=$goods item=good}>
			<tr>
				<td bgcolor="#ffffff" align="center"><a href="goods.php?goods_id=<{$good.goods_id}>"><{$good.goods_name}></a></td>
				<td align="center" bgcolor="#ffffff">￥&nbsp;<{$good.market_price}>元</td>
				<td align="center" bgcolor="#ffffff" class="price">￥&nbsp;<{$good.shop_price}>元</td>
				<td align="center" bgcolor="#ffffff">
					<input type="text" onblur="num(this, 'goods_number_<{$good.goods_id}>');" id="goods_number_<{$good.goods_id}>" value="<{$good.num}>" size="4" class="InputBorder"/>
					<input type="hidden" name="goods_id" value="<{$good.goods_id}>" />	
				</td>
				<td align="center" bgcolor="#ffffff" id="price_goods_number_<{$good.goods_id}>" class="price">￥&nbsp;<{$good.total}>元</td>
				<td align="center" bgcolor="#ffffff">
					<acronym class="delete"></acronym><a href="javacript:;" onclick="goods_del(this, '<{$good.goods_id}>');" ><u class="b">删除</u></a>&nbsp;&nbsp;
				</td>
			</tr>
			<{/foreach}>
			<{/if}>
			<tr>
				<td bgcolor="#ffffff" align="center">总计</td>
				<td align="center" bgcolor="#ffffff" id="price" class="price">￥&nbsp;<{if $price neq ''}><{$price}><{else}>0.00<{/if}>元</td>
			</tr>
		</table>
		
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="0" bgcolor="#f9f9f9">
			<tr>
				<!-- <td class="f1 f14b">
				商品的描述
				</td> -->
				<td align="right">
					<a href="flow.php?act=clear"><img src="../templates/front/images/food/cart-3.gif"/></a>
				</td>
			</tr>
		</table>
		
		<input type="hidden" name="step" value="update_cart" />
	</form>
	
	<table width="99%" align="center" border="0" cellpadding="5" cellspacing="0" class="floatTable">
		<tr>
			<td><a href="index.php"><img src="../templates/front/images/continue.gif" /></a></td>
			<td align="right"><a href="flow.php?act=checkOut"><img src="../templates/front/images/checkout.gif" /></a></td>
		</tr>
	</table>

</div>
<{/if}>
<!-- 购物车列表end -->


<!-- 收货人信息填写界面start -->
<{if $action eq 'consignee'}>

<div class="block">
	<form action="flow.php?act=regionInsert" method="post" name="theForm" id="theForm" onsubmit="return checkConsignee(this)">
		<div class="goodsTitle">收货人信息</div>
			<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">   
				<tr>
					<td bgcolor="#ffffff">配送区域:</td>
					<td colspan="3" bgcolor="#ffffff">
					<select name="country" id="selCountries_0" onchange="region(this, 'selCountries_0')"  class="InputBorder">
						<option value="0" selected="selected">请选择国家</option>
						<option value="1">中国</option>
					</select>
					<select name="province" id="selProvinces_0" onchange="region(this, 'selProvinces_0')"  class="InputBorder">
						<option value="0" selected="selected">请选择省</option>
					</select>
					<select name="city" id="selCities_0" onchange="region(this, 'selCities_0')"  class="InputBorder">
						<option value="0" selected="selected">请选择市</option>
					</select>
					<!-- <select name="district" id="selDistricts_0" style="display:none"  class="InputBorder"> -->
					<select name="district" id="selDistricts_0"  class="InputBorder">
						<option value="0" selected="selected">请选择区</option>
					</select>(必填) 
					</td>
				</tr>
				<tr>
					<td bgcolor="#ffffff">收货人姓名:</td>
					<td bgcolor="#ffffff"><input name="consignee" type="text" class="InputBorder" id="consignee_0" value="" />
					(必填) </td>
					<td bgcolor="#ffffff">电子邮件地址:</td>
					<td bgcolor="#ffffff"><input name="email" type="text" class="InputBorder"  id="email_0" value="sng@qq.fm" />
					(必填)</td>
				</tr> 
				<tr>
					<td bgcolor="#ffffff">详细地址:</td>
					<td bgcolor="#ffffff"><input name="address" type="text" class="InputBorder"  id="address_0" value="" />
					(必填)</td>
					<td bgcolor="#ffffff">邮政编码:</td>
					<td bgcolor="#ffffff"><input name="zipcode" type="text" class="InputBorder"  id="zipcode_0" value="" /></td>
				</tr>
				<tr>
					<td bgcolor="#ffffff">电话:</td>
					<td bgcolor="#ffffff"><input name="tel" type="text" class="InputBorder"  id="tel_0" value="" />
					(或者电话必填一种)</td>
					<td bgcolor="#ffffff">手机:</td>
					<td bgcolor="#ffffff"><input name="mobile" type="text" class="InputBorder"  id="mobile_0" value="" />
					(或者手机必填一种)</td>
				</tr>
				<tr>
					<td colspan="4" align="center" bgcolor="#ffffff">
						<input type="submit" name="Submit" class="bnt_number8" value="配送至这个地址" />
						<input type="hidden" name="step" value="consignee" />
						<input type="hidden" name="act" value="checkout" />
						<input name="address_id" type="hidden" value="" />
					</td>
				</tr>
		</table>
	</form>
</div>

<{/if}>
<!-- 收货人信息end -->


<!--  开始订单确认界面 start -->
<{if $action eq 'orderConfirm'}>


<div class="blank"></div>
<div class="ur_here blank"><{$ur_here}></div>
<div class="block">
	<div class="blank"></div>
	<form action="flow.php?act=done" method="post" name="theForm" id="theForm" onsubmit="return checkOrderForm(this)">
		<!-- 商品列表start -->
		<div class="goodsTitle clearfix" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">
			<span class="fl">商品列表</span><a href="flow.php?act=list" class="fr">修改</a>
		</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">
			<tr>
				<th bgcolor="#ffffff">商品名称</th>
				<th bgcolor="#ffffff">价格</th>
				<th bgcolor="#ffffff">购买数量</th>
				<th bgcolor="#ffffff">小计</th>
			</tr>
			<{foreach from=$goods item=good}>
			<tr>
				<td bgcolor="#ffffff" align="center"><a href="goods.php?goods_id=<{$good.goods_id}>"><{$good.goods_name}></a></td>
				<td align="center" bgcolor="#ffffff" class="price"><{$good.shop_price}></td>
				<td align="center" bgcolor="#ffffff"><{$good.num}></td>
				<td align="center" bgcolor="#ffffff" class="price">￥&nbsp;<{$good.total}>元</td>
			</tr>
			<{/foreach}>
			<tr class="price">
				<td align="right" >总计&nbsp;&nbsp;￥&nbsp;<{$price}>元</td>
				<input type="hidden" value="<{$price}>" id="shop_price" />
			</tr>
		</table>
		<!-- 商品列表end -->
		
		<!-- 收货人信息start -->
		<div class="goodsTitle clearfix" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">
			<span class="fl" >收货人信息</span><a href="flow.php?act=consignee_update&address_id=<{$consignee.address_id}>" class="fr f1">修改</a>
		</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">
			<tr>
				<td bgcolor="#ffffff">收货人姓名:</td>
				<td bgcolor="#ffffff"><{$consignee.consignee}></td>
				<td bgcolor="#ffffff">电子邮件地址:</td>
				<td bgcolor="#ffffff"><{$consignee.email}></td>
			</tr>
			<tr>
				<td bgcolor="#ffffff">详细地址:</td>
				<td bgcolor="#ffffff"><{$consignee.address}></td>
				<td bgcolor="#ffffff">邮政编码:</td>
				<td bgcolor="#ffffff"><{$consignee.address}></td>
			</tr>
			<tr>
				<td bgcolor="#ffffff">电话:</td>
				<td bgcolor="#ffffff"><{$consignee.tel}></td>
				<td bgcolor="#ffffff">手机:</td>
				<td bgcolor="#ffffff"><{$consignee.mobile}></td>
			</tr>
			<input type="hidden" name="address_id2" value="<{$consignee.address_id}>" />
		</table>
		<!-- 收货人信息end -->
		
		<!-- 配送方式start -->
		<div class="goodsTitle" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">配送方式
		</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable" id="shippingTable">
			<tr>
				<th bgcolor="#ffffff" width="5%">&nbsp;</th>
				<th bgcolor="#ffffff" width="25%">名称</th>
				<!-- <th bgcolor="#ffffff">订购描述</th> -->
				<th bgcolor="#ffffff" width="15%">费用</th>
				<th bgcolor="#ffffff" width="15%">保价费用</th>
			</tr>
			<{foreach from=$shippings item=shipping}>
			<tr>
				<td bgcolor="#ffffff" valign="top"><input name="shipping" type="radio" value="<{$shipping.shipping_id}>"  supportCod="0" insure="0"  onclick="count(this, '<{$shipping.shipping_id}>');" /></td>
				<td bgcolor="#ffffff" valign="top"><strong><{$shipping.shipping_name}></strong></td>
				<!-- <td bgcolor="#ffffff" valign="top"><{$shipping.shipping_desc}></td> -->
				<td bgcolor="#ffffff" align="right" valign="top" class="f1">￥<{$shipping.price}>元</td>
				<td bgcolor="#ffffff" align="right" valign="top">不支持保价</td>
			</tr>
			<{/foreach}>
			<tr>
				<td colspan="6" bgcolor="#ffffff" align="right"><label for="ECS_NEEDINSURE">
					<input name="need_insure" id="ECS_NEEDINSURE" type="checkbox"  onclick="selectInsure(this.checked)" value="1"  disabled="true"  />
					配送是否需要保价 </label>
				</td>
			</tr>
		</table>
		<!-- 配送方式end -->

		<!-- 支付方式start -->
		<div class="goodsTitle" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">支付方式
		</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable" id="paymentTable">
			<tr>
				<th width="5%" bgcolor="#ffffff">&nbsp;</th>
				<th width="20%" bgcolor="#ffffff">名称</th>
				<!-- <th bgcolor="#ffffff">订购描述</th>
				<th bgcolor="#ffffff" width="15%">手续费</th> -->
			</tr>		
			<tr>
				<td valign="top" bgcolor="#ffffff"><input type="radio" name="payment" value="1"  isCod="0"/></td>
				<td valign="top" bgcolor="#ffffff"><strong>余额支付</strong></td>
				<!-- <td valign="top" bgcolor="#ffffff">使用帐户余额支付。只有会员才能使用，通过设置信用额度，可以透支。</td>
				<td align="right" bgcolor="#ffffff" valign="top" class="f1">￥0.00元</td> -->
			</tr>			
			<tr>
				<td valign="top" bgcolor="#ffffff"><input type="radio" name="payment" value="2" checked isCod="0"/></td>
				<td valign="top" bgcolor="#ffffff"><strong>银行汇款/转帐</strong></td>
				<!-- <td valign="top" bgcolor="#ffffff">银行名称
				收款人信息：全称 ××× ；帐号或地址 ××× ；开户行 ×××。
				注意事项：办理电汇时，请在电汇单“汇款用途”一栏处注明您的订单号。</td>
				<td align="right" bgcolor="#ffffff" valign="top" class="f1">￥0.00元</td> -->
			</tr>		
			<tr>
				<td valign="top" bgcolor="#ffffff"><input type="radio" name="payment" value="3"  isCod="1" /></td>
				<td valign="top" bgcolor="#ffffff"><strong>货到付款</strong></td>
				<!-- <td valign="top" bgcolor="#ffffff">开通城市：×××
				货到付款区域：×××</td>
				<td align="right" bgcolor="#ffffff" valign="top" class="f1"><span id="ECS_CODFEE">￥5.00元</span></td> -->
			</tr>
		</table>
		<!-- 支付方式end -->
		
		<!-- 其它信息start -->
		<div class="goodsTitle" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">其它信息
		</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">
			<tr>
				<td valign="top" bgcolor="#ffffff"><strong>买家留言:</strong></td>
				<td bgcolor="#ffffff"><textarea name="postscript" cols="80" rows="3" id="postscript" class="InputBorder"></textarea></td>
			</tr>
		</table>
		<!-- 其它信息end -->
		
		<!-- 费用总计start -->
		<div class="goodsTitle" style="background:#f6f6f6; border:#E3E3E3 solid 1px; border-bottom:none;">费用总计
		</div>
		<div id="ECS_ORDERTOTAL">
			<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">
    			<tr>
    				<td align="right" bgcolor="#ffffff">
    					  商品总价: <font class="f1 f14b" id="shop_price2">￥&nbsp;<{$price}>元</font>
                        + 配送费用: <font class="f1 f14b" id="shipping_price">￥&nbsp;0.00元</font>
                    </td>
  				</tr>
			    <tr>
			    	<td align="right" bgcolor="#ffffff"> 应付款金额: <font class="f1 f14b" id="gross_price">￥&nbsp;<{$price}>元</font></td>
			  	</tr>
			</table>
		</div>
		<!-- 费用总计end -->
		
		<div align="center" style="margin:8px auto;">
			<input type="image" src="../templates/front/images/bnt_subOrder.gif" />
			<input type="hidden" name="step" value="done" />
		</div>
		
	</form>
</div>

<{/if}>
<!-- 订单确认 end -->


<!-- 修改地址 start -->
<{if $action eq 'consignee_update'}>
<div class="blank"></div>
<div class="ur_here blank">当前位置: <a href=".">首页</a> <code>&gt;</code> 购物流程</div>
<div class="block">
	<div class="blank"></div>
	<form action="flow.php?act=address_update&address_id=<{$address.address_id}>" method="post" name="theForm" id="theForm" onsubmit="return checkConsignee(this)">
		<div class="goodsTitle">收货人信息</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">  
			<tr>
				<td bgcolor="#ffffff">配送区域:</td>
				<td colspan="3" bgcolor="#ffffff">
				<select name="country" id="selCountries_3" onchange="region(this, 'selCountries_3');"  class="InputBorder">
					<option value="0" selected="selected">请选择国家</option>
					<option value="1">中国</option>
				</select>
				<select name="province" id="selProvinces_3" onchange="region(this, 'selProvinces_3')"  class="InputBorder">
					<option value="0" selected="selected">请选择省</option>
				</select>
				<select name="city" id="selCities_3" onchange="region(this, 'selCities_3')"  class="InputBorder">
					<option value="0" selected="selected">请选择市</option>
				</select>
				<select name="district" id="selDistricts_3"  class="InputBorder">
					<option value="0" selected="selected">请选择区</option>
				</select>(必填) 
				</td>
			</tr>
			<!-- 
			<input id="selCountries_2" type="hidden" value="<{$address.country}>" />
			<input id="selProvinces_2" type="hidden" value="<{$address.province}>" />
			<input id="selCities_2" type="hidden" value="<{$address.city}>" />
			<input id="selDistricts_2" type="hidden" value="<{$address.district}>" />
			 -->
			<tr>
				<td bgcolor="#ffffff">收货人姓名:</td>
				<td bgcolor="#ffffff"><input name="consignee" type="text" class="InputBorder" id="consignee_0" value="<{$address.consignee}>" />
				(必填) </td>
				<td bgcolor="#ffffff">电子邮件地址:</td>
				<td bgcolor="#ffffff"><input name="email" type="text" class="InputBorder"  id="email_0" value="<{$address.email}>" />
				(必填)</td>
			</tr>
			<tr>
				<td bgcolor="#ffffff">详细地址:</td>
				<td bgcolor="#ffffff"><input name="address" type="text" class="InputBorder"  id="address_0" value="<{$address.address}>" />
				(必填)</td>
				<td bgcolor="#ffffff">邮政编码:</td>
				<td bgcolor="#ffffff"><input name="zipcode" type="text" class="InputBorder"  id="zipcode_0" value="<{$address.zipcode}>" /></td>
			</tr>
			<tr>
				<td bgcolor="#ffffff">电话:</td>
				<td bgcolor="#ffffff"><input name="tel" type="text" class="InputBorder"  id="tel_0" value="<{$address.tel}>" />
				(必填)</td>
				<td bgcolor="#ffffff">手机:</td>
				<td bgcolor="#ffffff"><input name="mobile" type="text" class="InputBorder"  id="mobile_0" value="<{$address.mobile}>" /></td>
			</tr>
			<tr>
				<td colspan="4" align="center" bgcolor="#ffffff">
				<input type="submit" name="Submit" class="bnt_number8" value="配送至这个地址" />       
				<input name="button" type="button" onclick="if (confirm('您确定要删除该收货人信息吗？')) location.href='flow.php?step=drop_consignee&address_id=<{$address.address_id}>'"  class="bnt_number2" value="删除" />
				<!-- <input type="hidden" name="step" value="consignee" />
				<input type="hidden" name="act" value="checkout" />
				<input name="address_id" type="hidden" value="5" /> -->
				</td>
			</tr>
		</table>
	</form>
	<!-- 新增收货人信息 start -->
	<form action="flow.php?act=regionInsert" method="post" name="theForm" id="theForm" onsubmit="return checkConsignee(this)">
		<div class="goodsTitle">收货人信息</div>
		<table width="100%" align="center" border="0" cellpadding="5" cellspacing="1" bgcolor="#e3e3e3" class="floatTable">   
			<tr>
				<td bgcolor="#ffffff">配送区域:</td>
				<td colspan="3" bgcolor="#ffffff">
				<select name="country" id="selCountries_1" onchange="region(this, 'selCountries_1')"  class="InputBorder">
					<option value="0" selected="selected">请选择国家</option>
					<option value="1">中国</option>
				</select>
				<select name="province" id="selProvinces_1" onchange="region(this, 'selProvinces_1')"  class="InputBorder">
					<option value="0" selected="selected">请选择省</option>
				</select>
				<select name="city" id="selCities_1" onchange="region(this, 'selCities_1')"  class="InputBorder">
					<option value="0" selected="selected">请选择市</option>
				</select>
				<!-- <select name="district" id="selDistricts_0" style="display:none"  class="InputBorder"> -->
				<select name="district" id="selDistricts_1"  class="InputBorder">
					<option value="0" selected="selected">请选择区</option>
				</select>(必填) 
				</td>
			</tr>
			<tr>
				<td bgcolor="#ffffff">收货人姓名:</td>
				<td bgcolor="#ffffff"><input name="consignee" type="text" class="InputBorder" id="consignee_1" value="" />
				(必填) </td>
				<td bgcolor="#ffffff">电子邮件地址:</td>
				<td bgcolor="#ffffff"><input name="email" type="text" class="InputBorder"  id="email_1" value="sng@qq.fm" />
				(必填)</td>
			</tr>   
			<tr>
				<td bgcolor="#ffffff">详细地址:</td>
				<td bgcolor="#ffffff"><input name="address" type="text" class="InputBorder"  id="address_1" value="" />
				(必填)</td>
				<td bgcolor="#ffffff">邮政编码:</td>
				<td bgcolor="#ffffff"><input name="zipcode" type="text" class="InputBorder"  id="zipcode_1" value="" /></td>
			</tr>
			<tr>
				<td bgcolor="#ffffff">电话:</td>
				<td bgcolor="#ffffff"><input name="tel" type="text" class="InputBorder"  id="tel_1" value="" />
				(必填)</td>
				<td bgcolor="#ffffff">手机:</td>
				<td bgcolor="#ffffff"><input name="mobile" type="text" class="InputBorder"  id="mobile_1" value="" /></td>
			</tr> 
			<tr>
				<td colspan="4" align="center" bgcolor="#ffffff">
					<input type="submit" name="Submit" class="bnt_number8" value="配送至这个地址" />
					<input type="hidden" name="step" value="consignee" />
					<input type="hidden" name="act" value="checkout" />
					<input name="address_id" type="hidden" value="" />
				</td>
			</tr>
		</table>
	</form>
<!-- 新增收货人信息 end -->
</div>
<{/if}>
<!-- 修改地址 end -->


<!-- 购物成功 start -->
<{if $action eq 'shopSuccess'}>
<div class="blank"></div>
<div class="ur_here blank"><{$ur_here}></div>
<div class="block">
<div class="orderSuccess">
	<div class="order_sn tc">您的订单已提交成功，订单号：<font class="a"><{$order_sn}></font>
	</div>
	<p>现在，您可以 <a href="index.php">返回首页</a> 或去 <a href="user.php">用户中心</a></p>
	<br/>
</div></div>
<{/if}>
<!-- 购物成功 end -->

</body>

<{include file="../templates/front/footer.html"}>